//package com.yifushidai.api;
//
//import com.github.pagehelper.PageInfo;
//import com.yifushidai.annotation.UserHolder;
//import com.yifushidai.entity.ApiUniqueMac;
//import com.yifushidai.service.ApiUniqueMacService;
//import com.yifushidai.utils.ApiBaseAction;
//import com.yifushidai.utils.Res;
//import com.yifushidai.utils.UUIDUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiOperation;
//import org.apache.commons.lang.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.imageio.ImageIO;
//import java.awt.*;
//import java.io.File;
//import java.io.IOException;
//import java.io.InputStream;
//import java.util.List;
//
//@RestController
//@Api(tags = "ApiUniqueMacController")
//@RequestMapping("/api/unique_mac")
//public class ApiUniqueMacController extends ApiBaseAction {
//
//    @Autowired
//    private ApiUniqueMacService apiUniqueMacService;
//
//    @ApiOperation(value = "列表")
//    @GetMapping("/list")
//    public Res<List<ApiUniqueMac>> list() {
//        ApiUniqueMac record = new ApiUniqueMac();
//        record.setMobile(UserHolder.get().getMobile());
//        List<ApiUniqueMac> list = apiUniqueMacService.select(record);
//        PageInfo<ApiUniqueMac> pageInfo = new PageInfo<ApiUniqueMac>(list);
//        return Res.ok().datas(pageInfo.getList()).count(pageInfo.getTotal());
//    }
//
//    @ApiOperation(value = "搜索")
//    @ApiImplicitParams({
//            @ApiImplicitParam(paramType = "query", name = "alias", value = "别名", required = false),
//    })
//    @GetMapping("/search")
//    public Res<List<ApiUniqueMac>> search(String alias) {
//        List<ApiUniqueMac> list = apiUniqueMacService.searchByAlias(alias);
//        PageInfo<ApiUniqueMac> pageInfo = new PageInfo<ApiUniqueMac>(list);
//        return Res.ok().datas(pageInfo.getList()).count(pageInfo.getTotal());
//    }
//
//    @ApiOperation(value = "查询")
//    @ApiImplicitParams({
//            @ApiImplicitParam(paramType = "path", name = "mac", value = "联网盒mac", required = true),
//    })
//    @GetMapping("/query/{mac}")
//    public Res<List<ApiUniqueMac>> queryByMac(@PathVariable String mac) {
//        ApiUniqueMac record = new ApiUniqueMac();
//        record.setMac(mac);
//        List<ApiUniqueMac> list = apiUniqueMacService.select(record);
//        PageInfo<ApiUniqueMac> pageInfo = new PageInfo<ApiUniqueMac>(list);
//        return Res.ok().datas(pageInfo.getList()).count(pageInfo.getTotal());
//    }
//
//    @ApiOperation(value = "删除")
//    @ApiImplicitParams({
//            @ApiImplicitParam(paramType = "path", name = "mac", value = "联网盒mac", required = true),
//    })
//    @GetMapping("/delete/{mac}")
//    public Res delete(@PathVariable String mac) {
//        ApiUniqueMac record = new ApiUniqueMac();
//        record.setMac(mac);
//        int i = apiUniqueMacService.delete(record);
//        return i > 0 ? Res.ok() : Res.error();
//    }
//
//    @ApiOperation(value = "保存或更新")
//    @ApiImplicitParams({
//            @ApiImplicitParam(paramType = "form", name = "mac", value = "联网盒mac", required = true),
//            @ApiImplicitParam(paramType = "form", dataType = "file", name = "uploadFile", value = "用户头像图片文件流", required = false),
//    })
//    @PostMapping("/save")
//    public Res save(@ModelAttribute ApiUniqueMac record, MultipartFile uploadFile) throws IOException {
//        if (StringUtils.isBlank(record.getMobile())) {
//            record.setMobile(UserHolder.get().getMobile());
//        }
////        record.setImg(uploadImg(uploadFile));
//        int i = apiUniqueMacService.saveOrUpdate(record);
//        return i > 0 ? Res.ok() : Res.error();
//    }
//}